<?php
namespace app\model\admin;

use think\Db;

class Tags
{
    //获取tags列表
    public function get_tags_lists($where,$sort='',$paginate=10)
    {
        $result_lists = Db::name('tags')->where($where)->order($sort)->paginate($paginate);
        return $result_lists;
    }

    //tags详情
    public function tags_detail($where){
        $result = Db::name('tags')->where($where)->find();
        return $result;
    }

    //tags添加
    public function add_tags($data){
        $status = Db::name('tags')->insert($data);
        return $status;
    }

    //tags修改
    public function update_tags($where,$data){
        $status = Db::name('tags')->where($where)->update($data);
        return $status;
    }

    //tags删除
    public function delete_tags($array_id){
        $advert_delete = Db::name('tags')->delete($array_id);
        return $advert_delete;
    }

    //内容添加tags
    public function content_addtags($data){
        $status = Db::name('tag_relation')->insertAll($data);
        return $status;
    }

    //内容删除tags
    public function content_deltags($where){
        $status = Db::name('tag_relation')->where($where)->delete();
        return $status;
    }
    //查询内容tags列表
    public function content_gettags($where){
        $lists = Db::name('tag_relation')->where($where)->select();
        return $lists;
    }

    //in查询tags列表
    public function in_get_tags($in){
        $lists = Db::query("select id,title from lh_tags where id in($in)");
        return $lists;
    }


}


